1. Technical Field
This invention generally relates to computer systems, and more specifically relates to the debugging of computer programs.
2. Background Art
As the sophistication and complexity of computer hardware and software increase, the more difficult the software is to debug. Debugging is the process of finding problems, or “bugs”, during the development of a computer program. Most modern programming, environments include a debugger that provides tools for testing and debugging a computer program. Known debuggers allow the user to set one or more breakpoints in the computer program, which are points where the execution of the computer program is stopped so that the state of the program can be examined to verify that the program executed as designed.
In a multi-threaded computer program, multiple threads of execution are defined. Different threads of execution may be executed in parallel. In a computer system that has multiple processors, different threads of execution may be executed on different processors, providing true real-time parallel processing of the threads. Debugging a multi-threaded computer program is difficult because each thread runs independently of the other threads. When a breakpoint is hit in one of the threads, the debugger attempts to halt the other threads as quickly as possible, but it is possible for a thread to execute thousands or even hundreds of thousands of instructions to be executed before the thread is halted. This inability to stop the threads all at once, and the extra “run on” which results, presents an unrealistic view of the program execution to the user. Using known debuggers, a programmer may switch between threads after all threads have been halted, but the programmer has no idea how many instructions were executed in the threads where the breakpoint did not occur after the breakpoint was encountered in the other thread. For this reason, the programmer is presented with data in the debugger that may not be very helpful because it does not accurately represent the state of other threads when a breakpoint was encountered in a first thread. Without a mechanism and method for indicating where a thread was executing when a breakpoint in a different thread is encountered, programmers will continue to suffer from inefficient tools for debugging multi-threaded computer programs on multi-processor computer systems.